package com.atguigu.gmall.seckill.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * projectName: gmall
 *
 * @author: 陈鹏
 * time: 2022/10/17 21:07 星期一
 * description: 排队信息发送至redis使用的线程池配置类
 */
@Configuration
public class GmallThreadPoolConfig {

    /**
     * 自定义线程池
     * @return
     */
    @Bean
    public ThreadPoolExecutor threadPoolExecutor(){
        return new ThreadPoolExecutor(8,
                8,
                0, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(1000));
    }
}
